<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="douban.js"></script>
    <script>
        console.log(movies);
        // 打印出每部电影的名字
        var subjectArr = movies.subjects;
        for (var i = 0; i < subjectArr.length; i++) {
            // console.log(subjectArr[i].title);   //电影名字

            var str = '电影名字:' + subjectArr[i].title + ',导演:' + ',演员:';
            // 导演信息
            var directorArr = subjectArr[i].directors;
            for (var j = 0; j < directorArr.length; j++) {
                // console.log(directorArr[j].name);
                if (j == directorArr.length - 1) {
                    str += directorArr[j].name;
                } else {
                    str += directorArr[j].name + '/';
                }
            }
            // console.log(str);
            var castArr = subjectArr[i].casts;
            for (var k = 0; k < castArr.length; k++) {
                console.log(castArr[k].name);
                if (k == castArr.length - 1) {
                    str += castArr[k].name;
                } else {
                    str += castArr[k].name + '/';
                }
            }
            console.log(str);
        }
    </script>
</body>

</html>